package unseen.games.activity;

import unseen.games.taptap.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewStub;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

public class GenericActivity extends Activity{

	protected Animation pushLeftInAnimation;
	protected Animation pushLeftOutAnimation;
	protected Animation pushRightInAnimation;
	protected Animation pushRightOutAnimation;
	
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setupAnimations();
	}
	
	public void setupAnimations(){
		pushLeftInAnimation 	= AnimationUtils.loadAnimation(this, R.anim.push_left_in);
		pushLeftOutAnimation 	= AnimationUtils.loadAnimation(this, R.anim.push_left_out);
		pushRightInAnimation 	= AnimationUtils.loadAnimation(this, R.anim.push_right_in);
		pushRightOutAnimation 	= AnimationUtils.loadAnimation(this, R.anim.push_right_out);
	}
	
	public final View findView (int viewId, String stubName){
        View view = findViewById(viewId);
        if (view == null){
            int stubId = getResources().getIdentifier(stubName, "id", getPackageName());
            if (stubId > 0){
                ViewStub stub = (ViewStub) findViewById(stubId);
                if (stub != null){
                    view = stub.inflate();
                }
            }
        }
        return view;
    }
}
